﻿using System.Text;
using System.Web;
using System.Xml;

namespace MockingBird.Common.Infrastructure.Http
{
    /// <summary>
    /// This class is used to write to the Http response stream.
    /// </summary>
    public class HttpResponseWriter
    {
        public static void WriteResponse(string responseData)
        {
            HttpContext httpContext = HttpContext.Current;
            httpContext.Response.ContentType = "text/xml";
            //wrap the data
            //TODO: Use a CDATA to be safe
            string xmlData = "<Response>" + responseData + "</Response>";
            XmlTextWriter xtw = new XmlTextWriter(httpContext.Response.OutputStream, Encoding.UTF8);
            xtw.WriteRaw(xmlData);
            xtw.Close();


        }
    }
}
